package com.bdqn.appjob.controller;

import javax.annotation.Resource;

import com.bdqn.appjob.service.backend.BackAppVersionService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.bdqn.appjob.entity.AppInfo;
import com.bdqn.appjob.entity.AppVersion;
import com.bdqn.appjob.service.backend.BackAppInfoService;

@Controller
@RequestMapping(value="manager/backend/app")
public class ViewController {
	private Logger logger = Logger.getLogger(ViewController.class);
	@Resource
	private BackAppInfoService appInfoService;
	@Resource
	private BackAppVersionService appVersionService;
	//根据id查看审核界面
	@RequestMapping(value="/check",method=RequestMethod.GET)
	public String viewCheck(@RequestParam(value="aid",required=false) String appinfoid,
			@RequestParam(value="vid",required=false)String versionid,Model model){
		logger.debug("进来了="+appinfoid);
		logger.debug("第二个进来了="+versionid);
		AppInfo appinfo = appInfoService.getListId(Integer.parseInt(appinfoid));
		AppVersion appVersion = appVersionService.getVersionId(Integer.parseInt(versionid));
		System.out.println("appVersion="+appVersion);
		model.addAttribute("appInfo",appinfo);
		model.addAttribute("appVersion",appVersion);
		return "backend/appcheck";
	}

}
